package com.journey.org.ui.knowledge.play

import android.app.Application
import androidx.lifecycle.viewModelScope
import com.journey.org.app.HttpManager
import com.journey.org.entity.GankMenuEntity
import com.journey.org.entity.PlayAndroidMenuEntity
import com.mvvmhabit.org.base.BaseViewModel
import com.mvvmhabit.org.bus.event.SingleLiveEvent
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.launch
import kotlinx.coroutines.withContext

class PlayAndroidMenuViewModel(application: Application) : BaseViewModel(application) {

    val onPlayAndroidMenuDataEvent = SingleLiveEvent<List<PlayAndroidMenuEntity>>()

    override fun onCreate() {
        super.onCreate()
        loadPlayAndroidMenuList()
    }

    private fun loadPlayAndroidMenuList() {
//        viewModelScope.launch(Dispatchers.Main) {
//            val entities = withContext(Dispatchers.IO) {
//                HttpManager.getInstance().loadPlayAndroidMenuList()
//            }
//            onPlayAndroidMenuDataEvent.setValue(entities!!)
//        }
    }

}